package com.seelyn.ddvideo.repository;

import com.seelyn.ddvideo.model.Video;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author slacrey
 * @since 2017/6/10
 */
@Repository
public interface VideoRepository extends MongoRepository<Video, String> {

    public Video findVideoById(String id);

    public Video findVideoByTitle(String title);

    public Video findVideoByFromSiteAndTitle(String fromSite, String title);

    public Page<Video> findVideoByTitleLike(String title, Pageable pageable);

    public Page<Video> findVideoByTitleLikeAndMovieTypeLessThanEqual(String title, Integer movieType, Pageable pageable);

    public Page<Video> findVideoByTitleLikeAndMovieTypeLessThanEqualAndSubType(String title, Integer movieType, Integer subType, Pageable pageable);

    public Page<Video> findVideoByMovieType(Integer movieType, Pageable pageable);

    public Page<Video> findVideoByMovieTypeLessThanEqual(Integer movieType, Pageable pageable);

    public Page<Video> findVideoByTitleLikeAndMovieType(String title, Integer type, Pageable pageable);

    public Video findVideoByVid(String vid);

    public Video findVideoByFromSiteAndVid(String fromSite, String vid);

    public List<Video> findVideoByFromSiteOrderByScore(String fromSite);

    public List<Video> findVideoByFromSiteAndMovieTypeOrderByScore(String fromSite, Integer type);

    public Page<Video> findVideoByFromSiteAndMovieType(String fromSite, Integer type, Pageable pageable);

    public Page<Video> findVideoByFromSiteAndMovieTypeOrderByScore(String fromSite, Integer type, Pageable pageable);

    public Page<Video> findByFromSiteAndMovieTypeAndDelFlagFalse(String fromSite, Integer type, Pageable pageable);

    public Page<Video> findByMovieTypeAndDelFlagFalse(Integer type, Pageable pageable);

    public Page<Video> findVideoByFromSiteOrderByScore(String fromSite, Pageable pageable);

}
